/*
 * @FilePath: /etws-sxk2307/src/packetResolver/sxkCmdV1/sxkProcotol.cpp
 * @Description:  
 * @Author: ipk518 && 18163976442@163.com
 * @Date: 2024-05-15 09:57:10
 * @LastEditors: ipk518 18163976442@163.com
 * @LastEditTime: 2024-08-29 17:05:05
 * Copyright    : G AUTOMOBILE RESEARCH INSTITUTE CO.,LTD Copyright (c) 2024.
 */
#include "Server.h"
#include "sdsCmdV1.h"
#include "Lmx2820.h"
#include "Ad9171.h"
#include "Gpio.h"
#include "Uio.h"
#include "Mem.h"
#include "getConfig.h"
#include "autoCalibration.h"
#include "autoTbf.h"
// #include "servoMotor.h"
/**
 * @brief: 总电源控制
 * @return {*}
 */
int sxk_callback_0(struct cmdDataType* cmd,uint8_t * cmdData)
{
    if(cmd == nullptr) {
        qlog_e("SxkCmd0::m_data is null..");
        return -1;
    }
    if (cmd->dataLen > 0) {
        qlog_i("执行电源控制..");
        bool m_status = false;
        (cmdData[0] > 0)?m_status = true : m_status = false;
        Server::Instance().m_sxk.powerControl(m_status,0,0);//0,0代表全选

        struct cmdDataType m_replay;
        memcpy(&m_replay,cmd,sizeof(struct cmdDataType));
        m_replay.source_DevType = cmd->dst_DevType;
        m_replay.source_DevNum = cmd->dst_DevNum;
        m_replay.dst_DevType = cmd->source_DevType;
        m_replay.dst_DevNum = cmd->source_DevNum;
        m_replay.dataLen = 0;
        Server::Instance().separate(s_sds,1,&m_replay,cmdData);
        if (m_status == false) { //1、一键掉电后清除AD组件状态.2、准备一键上电后需重新同步
            Server::Instance().m_hrServer->setAlive(AD_Sub_Unit_S,0,false);
            Server::Instance().m_hrServer->setAlive(AD_Sub_Unit_S,1,false);
        }
    } else {
        auto err = new Message(MsgKind::ZhIncorrectChecksum);
        string addMsg("总电源控制.");
        err->appendInfo(addMsg);
        qlog_e("%s",err->message().c_str());
    }
    return 0;
}

/**
 * @brief: 电源分控
 * @return {*}
 */
int sxk_callback_1(struct cmdDataType* cmd,uint8_t * cmdData)
{
    if(cmd == nullptr) {
        qlog_e("SxkCmd1::m_data is null..");
        return -1;
    }
    if (cmd->dataLen > 0) {
        qlog_i("执行电源指定控制..");
        bool m_status = false;
        (cmdData[2] > 0)?m_status = true : m_status = false;
        Server::Instance().m_sxk.powerControl(m_status,cmdData[0],cmdData[1]);//0,0代表全选

        struct cmdDataType m_replay;
        memcpy(&m_replay,cmd,sizeof(struct cmdDataType));
        m_replay.source_DevType = cmd->dst_DevType;
        m_replay.source_DevNum = cmd->dst_DevNum;
        m_replay.dst_DevType = cmd->source_DevType;
        m_replay.dst_DevNum = cmd->source_DevNum;
        m_replay.dataLen = 0;
        Server::Instance().separate(s_sds,1,&m_replay,cmdData);
    } else {
        auto err = new Message(MsgKind::ZhIncorrectChecksum);
        string addMsg("分电源控制.");
        err->appendInfo(addMsg);
        qlog_e("%s",err->message().c_str());
    }
    return 0;
}

/**
 * @brief: 时序发生器配置
 * @param {cmdDataType*} cmd
 * @param {uint8_t *} cmdData
 * @return {*}
 */
int sxk_callback_2(struct cmdDataType* cmd,uint8_t * cmdData)
{
    if(cmd == nullptr && cmdData == nullptr) {
        qlog_e("SxkCmd2::指令为空.");
        return -1;
    }
    
    Server::Instance().m_sxk.m_controlReg.m_timingStatus = *cmdData;
    qlog_i("时序发生器:%x",*cmdData);
    Server::Instance().m_event.triggerEvent(WRITE_CONTROL_REG);

    struct cmdDataType m_replay;
    memcpy(&m_replay,cmd,sizeof(struct cmdDataType));
    m_replay.source_DevType = cmd->dst_DevType;
    m_replay.source_DevNum = cmd->dst_DevNum;
    m_replay.dst_DevType = cmd->source_DevType;
    m_replay.dst_DevNum = cmd->source_DevNum;
    m_replay.dataLen = 0;
    Server::Instance().separate(s_sds,1,&m_replay,cmdData);
    return 0;
}
/**
 * @brief: 有效波位设置
 * @param {cmdDataType*} cmd
 * @param {uint8_t *} cmdData
 * @return {*}
 */
int sxk_callback_3(struct cmdDataType* cmd,uint8_t * cmdData)
{
    if(cmd == nullptr && cmdData == nullptr) {
        qlog_e("SxkCmd3::指令为空.");
        return -1;
    }
    Server::Instance().m_sxk.m_controlReg.m_taskBeamNum = *cmdData;
    qlog_i("有效波位设置:%x",*cmdData);
    Server::Instance().m_event.triggerEvent(WRITE_CONTROL_REG);

    struct cmdDataType m_replay;
    memcpy(&m_replay,cmd,sizeof(struct cmdDataType));
    m_replay.source_DevType = cmd->dst_DevType;
    m_replay.source_DevNum = cmd->dst_DevNum;
    m_replay.dst_DevType = cmd->source_DevType;
    m_replay.dst_DevNum = cmd->source_DevNum;
    m_replay.dataLen = 0;
    Server::Instance().separate(s_sds,1,&m_replay,cmdData);
    return 0;
}

/**
 * @brief: 所有时钟复位（hmc7044,lmx2820,ad9171）
 * @param {cmdDataType*} cmd
 * @param {uint8_t *} cmdData
 * @return {*}
 */
int sxk_callback_4(struct cmdDataType* cmd,uint8_t * cmdData)
{
    if(cmd == nullptr && cmdData == nullptr) {
        qlog_e("SxkCmd4::指令为空.");
        return -1;
    }
    struct cmdDataType m_replay;
    memcpy(&m_replay,cmd,sizeof(struct cmdDataType));
    m_replay.source_DevType = cmd->dst_DevType;
    m_replay.source_DevNum = cmd->dst_DevNum;
    m_replay.dst_DevType = cmd->source_DevType;
    m_replay.dst_DevNum = cmd->source_DevNum;
    if(*cmdData < RESET_NUM) {
        int ret =*cmdData;
        qlog_i("reset 有效:%d",*cmdData);
        Server::Instance().m_sxk.resetInit(ret);
        m_replay.DevStatus = CMD_OK;
    } else {
        qlog_e("reset 无效:%d",*cmdData);
        m_replay.DevStatus = CMD_ERR;
    }

    m_replay.dataLen = 0;
    Server::Instance().separate(s_sds,1,&m_replay,cmdData);

    return 0;
}

/*** 
 * @description: 中频发射校准水平命令
 * @param {cmdDataType*} cmd
 * @param {uint8_t *} cmdData
 * @return {*}
 */
int sxk_callback_5(struct cmdDataType* cmd,uint8_t * cmdData)
{
    Server::Instance().m_calibSub->m_ackChannel = 1;
    if ( !Server::Instance().caliAnalog(TIME_H_SEND_CALL)) {//由中断应答
        Server::Instance().m_sxk.m_calibParam.m_calibMode = *cmdData;   //TODO：2025/2/12
        Server::Instance().m_sxk.m_calibParam.m_calibFreq = *(cmdData+1);
        //写入timing_gen_ctrl_0寄存器
        Server::Instance().m_sxk.m_controlReg.m_timingStatus = TIME_H_SEND_CALL;//H极化发射校准
        Server::Instance().m_event.triggerEvent(WRITE_CONTROL_REG);//启动写入控制寄存器
    }
    return 0;
}

/*** 
 * @description: 中频发射校准垂直命令
 * @param {cmdDataType*} cmd
 * @param {uint8_t *} cmdData
 * @return {*}
 */
int sxk_callback_6(struct cmdDataType* cmd,uint8_t * cmdData)
{
    Server::Instance().m_calibSub->m_ackChannel = 1;
    if ( !Server::Instance().caliAnalog(TIME_V_SEND_CALL)) {
        Server::Instance().m_sxk.m_calibParam.m_calibMode = *cmdData;   //TODO：2025/2/12
        Server::Instance().m_sxk.m_calibParam.m_calibFreq = *(cmdData+1);
        //由中断应答
        //写入timing_gen_ctrl_0寄存器
        Server::Instance().m_sxk.m_controlReg.m_timingStatus = TIME_V_SEND_CALL;//V极化发射校准
        Server::Instance().m_event.triggerEvent(WRITE_CONTROL_REG);//启动写入控制寄存器
    }
    return 0;
}

/*** 
 * @description: 与雷象协议一致
 * @param {cmdDataType*} cmd
 * @param {uint8_t *} cmdData
 * @return {*}
 */
int sxk_callback_7(struct cmdDataType* cmd,uint8_t * cmdData)
{
    Server::Instance().m_calibSub->m_ackChannel = 1;
    if ( !Server::Instance().caliAnalog(TIME_H_REVICE_CALL)) {
        Server::Instance().m_sxk.m_calibParam.m_calibMode = *cmdData;   //TODO：2025/2/12
        Server::Instance().m_sxk.m_calibParam.m_calibFreq = *(cmdData+1);
        switch(Server::Instance().m_sxk.m_calibParam.m_calibMode)
        {
            case 0:
                Server::Instance().m_sxk.m_controlReg.m_manualCailbCoe = 1;
                Server::Instance().m_sxk.m_controlReg.m_autoCailbCoe = 1;
            break;
            case 1:
                Server::Instance().m_sxk.m_controlReg.m_manualCailbCoe = 0;
                Server::Instance().m_sxk.m_controlReg.m_autoCailbCoe = 1;
            break;
            case 2:
                Server::Instance().m_sxk.m_controlReg.m_manualCailbCoe = 0;
                Server::Instance().m_sxk.m_controlReg.m_autoCailbCoe = 0;
            break;
            default:
                Server::Instance().m_sxk.m_controlReg.m_manualCailbCoe = 1;
                Server::Instance().m_sxk.m_controlReg.m_autoCailbCoe = 1;
            break;
        }

        //写入timing_gen_ctrl_0寄存器
        Server::Instance().m_sxk.m_controlReg.m_timingStatus = TIME_H_REVICE_CALL;//V极化接收校准
        Server::Instance().m_event.triggerEvent(WRITE_CONTROL_REG);//启动写入控制寄存器
    }
    
    return 0;
}

/*** 
 * @description: 与雷象协议一致
 * @param {cmdDataType*} cmd
 * @param {uint8_t *} cmdData
 * @return {*}
 */
int sxk_callback_8(struct cmdDataType* cmd,uint8_t * cmdData)
{  
    Server::Instance().m_calibSub->m_ackChannel = 1;
    if ( !Server::Instance().caliAnalog(TIME_V_REVICE_CALL)) { //由中断应答
        Server::Instance().m_sxk.m_calibParam.m_calibMode = *cmdData;   //TODO：2025/2/12
        Server::Instance().m_sxk.m_calibParam.m_calibFreq = *(cmdData+1);
        switch(Server::Instance().m_sxk.m_calibParam.m_calibMode)
        {
            case 0:
                Server::Instance().m_sxk.m_controlReg.m_manualCailbCoe = 1;
                Server::Instance().m_sxk.m_controlReg.m_autoCailbCoe = 1;
            break;
            case 1:
                Server::Instance().m_sxk.m_controlReg.m_manualCailbCoe = 0;
                Server::Instance().m_sxk.m_controlReg.m_autoCailbCoe = 1;
            break;
            case 2:
                Server::Instance().m_sxk.m_controlReg.m_manualCailbCoe = 0;
                Server::Instance().m_sxk.m_controlReg.m_autoCailbCoe = 0;
            break;
            default:
                Server::Instance().m_sxk.m_controlReg.m_manualCailbCoe = 1;
                Server::Instance().m_sxk.m_controlReg.m_autoCailbCoe = 1;
            break;
        }

        //写入timing_gen_ctrl_0寄存器
        Server::Instance().m_sxk.m_controlReg.m_timingStatus = TIME_V_REVICE_CALL;//V极化接收校准
        Server::Instance().m_event.triggerEvent(WRITE_CONTROL_REG);//启动写入控制寄存器
    }
    return 0;
}

/*** 
 * @description: 不带固定误差的接收校准流程
 * @param {cmdDataType*} cmd
 * @param {uint8_t *} cmdData
 * @return {*}
 */
int sxk_callback_9(struct cmdDataType* cmd,uint8_t * cmdData)
{
    return 0;
}

/*** 
 * @description: 读取AD9171寄存器
 * @param {cmdDataType*} cmd
 * @param {uint8_t *} cmdData
 * @return {*}
 */
int sxk_callback_10(struct cmdDataType* cmd,uint8_t * cmdData)
{
    if(cmd == nullptr && cmdData == nullptr) {
        qlog_e("SxkCmd10::读取AD9171指令为空.");
        return -1;
    }
    
    struct cmdDataType m_replay;
    memcpy(&m_replay,cmd,sizeof(struct cmdDataType));
    m_replay.source_DevType = cmd->dst_DevType;
    m_replay.source_DevNum = cmd->dst_DevNum;
    m_replay.dst_DevType = cmd->source_DevType;
    m_replay.dst_DevNum = cmd->source_DevNum;

    uint32_t reg = (uint32_t)(*(uint16_t *)cmdData << 16);
    uint8_t value = 0;
    
    reg = 0x800000 | reg;
    value = ad9171WrRd(reg);
    qlog_i("ad9171 地址读:%#x,值：%#x",reg,value);
    m_replay.DevStatus = CMD_OK;
    m_replay.dataLen = 1;

    Server::Instance().separate(s_sds,1,&m_replay,&value);
    return 0;
}

/*** 
 * @description: 设置AD9171寄存器
 * @param {cmdDataType*} cmd
 * @param {uint8_t *} cmdData
 * @return {*}
 */
int sxk_callback_11(struct cmdDataType* cmd,uint8_t * cmdData)
{
    if(cmd == nullptr && cmdData == nullptr) {
        qlog_e("SxkCmd11::写入AD9171指令为空.");
        return -1;
    }
    struct cmdDataType m_replay;
    memcpy(&m_replay,cmd,sizeof(struct cmdDataType));
    m_replay.source_DevType = cmd->dst_DevType;
    m_replay.source_DevNum = cmd->dst_DevNum;
    m_replay.dst_DevType = cmd->source_DevType;
    m_replay.dst_DevNum = cmd->source_DevNum;
    uint16_t addr = *(uint16_t *)cmdData;
    uint16_t value = *(uint16_t *)(cmdData + 2);
    uint32_t reg = (uint32_t)(addr << 16 | value);

    qlog_n("ad9171 地址写入:%#x.",reg);
    ad9171WrRd(reg);
    m_replay.DevStatus = CMD_OK;

    
    Server::Instance().separate(s_sds,1,&m_replay,cmdData);
    return 0;
}

/*** 
 * @description: 读取lmx2820寄存器
 * @param {cmdDataType*} cmd
 * @param {uint8_t *} cmdData
 * @return {*}
 */
int sxk_callback_12(struct cmdDataType* cmd,uint8_t * cmdData)
{
    if(cmd == nullptr && cmdData == nullptr) {
        qlog_e("SxkCmd12::读取lmx2820指令为空.");
        return -1;
    }
    
    struct cmdDataType m_replay;
    memcpy(&m_replay,cmd,sizeof(struct cmdDataType));
    m_replay.source_DevType = cmd->dst_DevType;
    m_replay.source_DevNum = cmd->dst_DevNum;
    m_replay.dst_DevType = cmd->source_DevType;
    m_replay.dst_DevNum = cmd->source_DevNum;

    uint32_t reg = (uint32_t)(*(uint16_t *)cmdData << 16);
    uint16_t value = 0;
    uint16_t replayData[2];
    

    reg = 0x800000 | reg;
    value = lmx2820WrRd(reg);
    qlog_n("lmx2820 地址读:%#x,值：%#x",reg,value);
    m_replay.DevStatus = CMD_OK;
    m_replay.dataLen = 4;
    replayData[0] = *(uint16_t *)cmdData;
    replayData[1] = value;
    Server::Instance().separate(s_sds,1,&m_replay,(uint8_t *)replayData);
    return 0;
}

/*** 
 * @description: 设置lmx2820寄存器,先地址后数据
 * @param {cmdDataType*} cmd
 * @param {uint8_t *} cmdData
 * @return {*}
 */
int sxk_callback_13(struct cmdDataType* cmd,uint8_t * cmdData)
{
    if(cmd == nullptr && cmdData == nullptr) {
        qlog_e("SxkCmd13::写入lmx2820指令为空.");
        return -1;
    }
    struct cmdDataType m_replay;
    memcpy(&m_replay,cmd,sizeof(struct cmdDataType));
    m_replay.source_DevType = cmd->dst_DevType;
    m_replay.source_DevNum = cmd->dst_DevNum;
    m_replay.dst_DevType = cmd->source_DevType;
    m_replay.dst_DevNum = cmd->source_DevNum;
    uint16_t addr = *(uint16_t *)cmdData;
    uint16_t value = *(uint16_t *)(cmdData + 2);
    uint32_t reg = (uint32_t)(addr << 16 | value);

    qlog_n("lmx2820 地址写入:%#x.",reg);
    lmx2820WrRd(reg);
    m_replay.DevStatus = CMD_OK;

    
    Server::Instance().separate(s_sds,1,&m_replay,cmdData);
    return 0;
}

/*** 
 * @description: 初始化AD同步
 * @param {cmdDataType*} cmd
 * @param {uint8_t *} cmdData
 * @return {*}
 */
int sxk_callback_14(struct cmdDataType* cmd,uint8_t * cmdData)
{
    if(cmd == nullptr && cmdData == nullptr) {
        qlog_e("SxkCmd14::AD同步指令为空.");
        return -1;
    }
    if (*cmdData > 0) {
        setGpioValue(Conf::currentConf()->mGpioConf.uPlAdSync,1);
    } else {
        setGpioValue(Conf::currentConf()->mGpioConf.uPlAdSync,0);
    }
    return 0;
}


/*** 
 * @description: 校准通道原始IQ
 * @param {cmdDataType*} cmd
 * @param {uint8_t *} cmdData
 * @return {*}
 */
int sxk_callback_15(struct cmdDataType* cmd,uint8_t * cmdData)
{
    if(cmd->dataLen < 3) {
        qlog_e("获取校准IQ值错误,参数下发错误.");
    }
    int m_mode = *cmdData,m_polar = *(cmdData+1),m_channel = *(cmdData+2);
    m_polar = (*(cmdData+1) == 0)?0:1;
    m_channel = (m_channel > 31)?m_channel:31;
    struct txCalibrationFrame txCalibIq;
    struct rxCalibrationFrame rxCalibIq;
    struct cmdDataType cmdHeader;
    cmdHeader.DeviceType = t_controlCmd;
    cmdHeader.source_DevType = CurDeviceType;
    cmdHeader.source_DevNum = ComponentNO;
    cmdHeader.dst_DevType =  CENTER_SERVER_Sub_Unit_S;
    cmdHeader.dst_DevNum = 0;
    cmdHeader.cmdType = cmd->cmdType;
    cmdHeader.cmdChildType = cmd->cmdChildType;
    cmdHeader.DevStatus = CMD_OK;
    cmdHeader.dataLen = sizeof(txCalibIq);//32768字节
    if(m_mode == 0) { //发射模式
        int fd  = openMem();
        memorySwap(fd, ((TX_CALIB_BASEADDR + TX_CALIB_OFFSET * m_polar) + TX_CALIB_CHN_OFFSET * m_channel),  
                            (unsigned char *)&txCalibIq, sizeof(txCalibIq), nullptr, 0);  
        closeMem(fd);
 
    } else if (m_mode == 1) { //接收模式
        int fd  = openMem();
        memorySwap(fd, (RX_CALIB_BASEADDR + RX_CALIB_OFFSET * m_polar),  
                            (unsigned char *)&rxCalibIq, sizeof(rxCalibIq), nullptr, 0); 
        closeMem(fd);
        //借用TX校准的结构形式上报
        txCalibIq.m_simpleNum = rxCalibIq.m_beamNum;
        txCalibIq.m_prtNum = rxCalibIq.m_prtNum;
        txCalibIq.m_cpiNum = rxCalibIq.m_simple;
        txCalibIq.m_notUse = rxCalibIq.m_waveCode;
        for(int j = 0;j < 4095;j++) {
            txCalibIq.m_iqBuffer[j] = rxCalibIq.m_iqBuffer[j][m_channel];
        }
        
    } else {
        qlog_e("校准通道原始IQ,模式设置错误.");
        return -1;
    }
    return Server::Instance().separate(s_sds,0,&cmdHeader,(unsigned char *)&txCalibIq);
}


/*** 
 * @description: 配置C幅度值,小上位机下发的值需要*100
 * @param {cmdDataType*} cmd
 * @param {uint8_t *} cmdData
 * @return {*}
 */
int sxk_callback_16(struct cmdDataType* cmd,uint8_t * cmdData)
{
    if (cmd->dataLen < 8) { //4字节幅度
        qlog_e("配置C幅度值时序卡命令%d,应该下发字节长度是8",cmd->cmdChildType);
        return -1;
    }
    memcpy((uint8_t *)cCoefficientAmp,cmdData,sizeof(cCoefficientAmp));
    qlog_n("频点0 C:%d",cCoefficientAmp[0]);
    qlog_n("频点1 C:%d",cCoefficientAmp[1]);
    int res = writeIntValue("LineLoss","c_freq0",cCoefficientAmp[0],Server::Instance().m_configPath.c_str());
    res = writeIntValue("LineLoss","c_freq1",cCoefficientAmp[1],Server::Instance().m_configPath.c_str());
    Server::Instance().responseSds(cmd);
    return res;
}

/*** 
 * @description: 配置校准标准值 
 * @param {cmdDataType*} cmd
 * @param {uint8_t *} cmdData
 * @return {*}
 */
int sxk_callback_17(struct cmdDataType* cmd,uint8_t * cmdData)
{
    if (cmd->dataLen < sizeof(mulitFreqStr)) { //1字节频点+1字节极化+2字节幅相*32,先幅度64字节再相位64字节
        qlog_e("这条命令需要640个字节.",cmd->cmdChildType);
        return -1;
    }
    memcpy((unsigned char *)&mulitFreqStr,cmdData,sizeof(mulitFreqStr));
    string str = Conf::currentConf()->mFilePath.uFreqReferencePath + string("/") + _REFERENCE_VALUE_;
    int ret = WriteFile(str.c_str(),(unsigned char *)&mulitFreqStr,sizeof(mulitFreqStr));
    if (ret < 0) {
        str = str + " , 写入失败.";
        qlog_e("%s",str.c_str());
    }
    Server::Instance().responseSds(cmd);
    return 0;
}

/*** 
 * @description: 读取自动校准值的最终下发结果
 * @param {cmdDataType*} cmd
 * @param {uint8_t *} cmdData
 * @return {*}
 */
int sxk_callback_18(struct cmdDataType* cmd,uint8_t * cmdData)
{
    if(cmd->dataLen == 0) return -1;

    struct cmdDataType m_replay;
    memcpy(&m_replay,cmd,sizeof(struct cmdDataType));
    m_replay.source_DevType = cmd->dst_DevType;
    m_replay.source_DevNum = cmd->dst_DevNum;
    m_replay.dst_DevType = cmd->source_DevType;
    m_replay.dst_DevNum = cmd->source_DevNum;
    m_replay.DevStatus = 0;
    qlog_n("获取自动校准修正值.");
    
    if (*cmdData == 0) {
        m_replay.dataLen = sizeof(struct ap_Control_t);
        Server::Instance().separate(s_sds,1,&m_replay,(uint8_t *)&ddsCacheStr_H);
    } else if(*cmdData == 1) {
        m_replay.dataLen = sizeof(struct ap_Control_t);
        Server::Instance().separate(s_sds,1,&m_replay,(uint8_t *)&ddsCacheStr_V);
    } else {
        memset((uint8_t *)&ddsCacheStr_H,0,sizeof(struct ap_Control_t));
        memset((uint8_t *)&ddsCacheStr_V,0,sizeof(struct ap_Control_t));
        qlog_w("自动校准修正值清0");
        return Server::Instance().responseSds(cmd);
    }

    return 0;
    
}


/**
 * @description: 下发耦合系数
 * 接收分HV两种耦合系数。保存也分hPort.dat/vPort.dat
 * @param {cmdDataType*} cmd
 * @param {uint8_t *} cmdData
 * @return {*}
 */
int sxk_callback_19(struct cmdDataType* cmd,uint8_t * cmdData)
{
    if(cmd->dataLen < 512){
        qlog_e("耦合系数需要513字节.");
        return -1;
    }
    int ret = 0;
    string str;
    //设置指定耦合系数
    uint8_t g_usPolar = *(cmdData);
    
    if(g_usPolar == 0) {
        float *p_data = (float *)(cmdData+1);
        str = Conf::currentConf()->mFilePath.uFreqPointPath + string("/") + _H_COUPLE_VALUE_;
        memcpy(hCoefficient,p_data,sizeof(hCoefficient));

        ret = WriteFile(str.c_str(),(unsigned char *)hCoefficient,sizeof(hCoefficient));
    } else if(g_usPolar == 1){
        float *p_data = (float *)(cmdData+1);
        str = Conf::currentConf()->mFilePath.uFreqPointPath + string("/") + _V_COUPLE_VALUE_;
        memcpy(vCoefficient,p_data,sizeof(vCoefficient));

        ret = WriteFile(str.c_str(),(unsigned char *)vCoefficient,sizeof(vCoefficient));
    } else {
        qlog_e("其他极化还未实现");
        return -1;
    }
    if(ret < 0) {
        qlog_e("写入文件:%s 失败!",str.c_str());
        return -1;
    }

    qlog_i("极化:%d,写入幅相耦合系数路径:%s!",g_usPolar,str.c_str());

    return Server::Instance().responseSds(cmd);
}

/*** 
 * @description: 雷达自动校准测试
 * @param {cmdDataType*} cmd
 * @param {uint8_t *} cmdData
 * @return {*}
 */
int sxk_callback_20(struct cmdDataType* cmd,uint8_t * cmdData)
{
    if (cmd->dataLen < 2) { //1字节频点+1字节极化+2字节幅相*32,先幅度64字节再相位64字节
        qlog_e("这条命令需要2个字节.",cmd->cmdChildType);
        return -1;
    }
    char data[2];
    data[0] = *cmdData;
    data[1] = *(cmdData+1);
    qlog_w("开始雷达自动校准.模式为=%d,运行次数=%d.",data[0],data[1]);
    Server::Instance().m_autoCalibSub->test(data,2);
    
    return Server::Instance().responseSds(cmd);
}

/*** 
 * @description: 配置TBFC幅度值,小上位机下发的值需要*100
 * @param {cmdDataType*} cmd
 * @param {uint8_t *} cmdData
 * @return {*}
 */
int sxk_callback_21(struct cmdDataType* cmd,uint8_t * cmdData)
{
    if (cmd->dataLen < 8) { //4字节幅度
        qlog_e("配置TBF C幅度值时序卡命令%d,应该下发字节长度是8",cmd->cmdChildType);
        return -1;
    }
    memcpy((uint8_t *)cCoefficientAmp,cmdData,sizeof(cCoefficientAmp));
    qlog_i("频点0 C:%d",cCoefficientAmp[0]);
    qlog_i("频点1 C:%d",cCoefficientAmp[1]);
    int res = writeIntValue("LineLoss","c_tbf_freq0",cCoefficientAmp[0],Server::Instance().m_configPath.c_str());
    res = writeIntValue("LineLoss","c_tbf_freq1",cCoefficientAmp[1],Server::Instance().m_configPath.c_str());
    Server::Instance().responseSds(cmd);
    return res;
}

/*** 
 * @description: 配置TBF校准标准值 
 * @param {cmdDataType*} cmd
 * @param {uint8_t *} cmdData
 * @return {*}
 */
int sxk_callback_22(struct cmdDataType* cmd,uint8_t * cmdData)
{
    if (cmd->dataLen < sizeof(tbf_mulitFreqStr)) { //1字节波位+sizeof(tbf_mulitFreqStr)
        qlog_e("这条命令需要16384个字节.",cmd->cmdChildType);
        return -1;
    }

    memcpy((unsigned char *)&tbf_mulitFreqStr,(cmdData),sizeof(tbf_mulitFreqStr));
    string str = Conf::currentConf()->mFilePath.uFreqReferencePath + string("/") + _TBF_REFERENCE_VALUE_;
    int ret = WriteFile(str.c_str(),(unsigned char *)&tbf_mulitFreqStr,sizeof(tbf_mulitFreqStr));
    if (ret < 0) {
        str = str + " , 写入失败.";
        qlog_e("%s",str.c_str());
    }
    Server::Instance().responseSds(cmd);
    return 0;
}

/*** 
 * @description: 读取TBF自动校准值的最终下发结果
 * @param {cmdDataType*} cmd
 * @param {uint8_t *} cmdData
 * @return {*}
 */
int sxk_callback_23(struct cmdDataType* cmd,uint8_t * cmdData)
{
    if(cmd->dataLen == 0) return -1;

    struct cmdDataType m_replay;
    memcpy(&m_replay,cmd,sizeof(struct cmdDataType));
    m_replay.source_DevType = cmd->dst_DevType;
    m_replay.source_DevNum = cmd->dst_DevNum;
    m_replay.dst_DevType = cmd->source_DevType;
    m_replay.dst_DevNum = cmd->source_DevNum;
    m_replay.DevStatus = 0;
    qlog_i("获取自动校准修正值.");
    
    if (*cmdData == 0) {
        m_replay.dataLen = sizeof(tbfCacheStr_H);
        Server::Instance().separate(s_sds,1,&m_replay,(uint8_t *)&tbfCacheStr_H);
    } else if(*cmdData == 1) {
        m_replay.dataLen = sizeof(tbfCacheStr_H);
        Server::Instance().separate(s_sds,1,&m_replay,(uint8_t *)&tbfCacheStr_V);
    } else {
        memset((uint8_t *)&tbfCacheStr_H,0,sizeof(tbfCacheStr_H));
        memset((uint8_t *)&tbfCacheStr_V,0,sizeof(tbfCacheStr_V));
        qlog_w("自动校准修正值清0");
        return Server::Instance().responseSds(cmd);
    }

    return 0;
    
}

/**
 * @description: 下发TBF的耦合系数
 * 接收分HV两种耦合系数。保存也分hPort.dat/vPort.dat
 * @param {cmdDataType*} cmd
 * @param {uint8_t *} cmdData
 * @return {*}
 */
int sxk_callback_24(struct cmdDataType* cmd,uint8_t * cmdData)
{
    if(cmd->dataLen < 512){
        qlog_e("TBF耦合系数需要513字节.");
        return -1;
    }
    int ret = 0;
    string str;
    //设置指定耦合系数
    uint8_t g_usPolar = *(cmdData);
    
    if(g_usPolar == 0) {
        float *p_data = (float *)(cmdData+1);
        str = Conf::currentConf()->mFilePath.uFreqPointPath + string("/") + _H_COUPLE_VALUE_;
        memcpy(hCoefficient,p_data,sizeof(hCoefficient));

        ret = WriteFile(str.c_str(),(unsigned char *)hCoefficient,sizeof(hCoefficient));
    } else if(g_usPolar == 1){
        float *p_data = (float *)(cmdData+1);
        str = Conf::currentConf()->mFilePath.uFreqPointPath + string("/") + _V_COUPLE_VALUE_;
        memcpy(vCoefficient,p_data,sizeof(vCoefficient));

        ret = WriteFile(str.c_str(),(unsigned char *)vCoefficient,sizeof(vCoefficient));
    } else {
        qlog_e("只有发射极化");
        return -1;
    }
    if(ret < 0) {
        qlog_e("写入文件:%s 失败!",str.c_str());
        return -1;
    }

    qlog_i("极化:%d,写入TBF耦合系数:%s!",g_usPolar,str.c_str());
    return Server::Instance().responseSds(cmd);
}

/*** 
 * @description: 雷达TBF校准测试
 * @param {cmdDataType*} cmd
 * @param {uint8_t *} cmdData
 * @return {*}
 */
int sxk_callback_25(struct cmdDataType* cmd,uint8_t * cmdData)
{
    if (cmd->dataLen < 4) { //1字节模式+1字节循环次数+1字节指定波位+1字节频点
        qlog_e("这条命令需要4个字节.",cmd->cmdChildType);
        return -1;
    }
    char data[4];
    memcpy(data,cmdData,4);
    qlog_w("开始雷达TBF自动校准.模式为=%d,运行次数=%d,指定波位=%d,频点=%d.",
    data[0],data[1],data[2],data[3]);
    Server::Instance().m_gloabl.SpecifiedBeamNum = data[2];
    Server::Instance().m_gloabl.SpecifiedFreq = data[3];
    Server::Instance().m_autoTbfSub->test(data,4);

    return Server::Instance().responseSds(cmd);
}

/*** 
 * @description: 配置观测通道 指定波位指定CPI指定PRT原始数据，需要开启时序配合
 * @param {cmdDataType*} cmd
 * @param {uint8_t *} cmdData
 * @return {*}
 */
int sxk_callback_26(struct cmdDataType* cmd,uint8_t * cmdData)
{
    if (cmd->dataLen < 3) { //通道，指定波位号,指定CPI,指定prt,指定频点
        qlog_e("这条命令需要3个字节.",cmd->cmdChildType);
        return -1;
    }
    uint8_t data[3];
    memcpy(data,cmdData,3);
    Server::Instance().m_sxk.m_uio->m_txWork.m_channel = data[0];    //指定DMA通道
    Server::Instance().m_sxk.m_uio->m_txWork.m_beamCode = data[1]; //指定波位号
    Server::Instance().m_sxk.m_uio->m_txWork.m_freqPoint = data[2];//指定频点

    Server::Instance().m_sxk.m_uio->m_txWork.m_runCount = 0; //准备开始轮循
    //标识一次IQ数据
    qlog_i("配置观测通道 dma:%d,code:%d,freq:%d.",data[0],data[1],data[2]);
    
    Server::Instance().m_sxk.m_uio->tiggerObsSem(uio_tx_observer);//开启持续观测

    return Server::Instance().responseSds(cmd);
}


/*** 
 * @description: 读取HMC7044寄存器
 * @param {cmdDataType*} cmd
 * @param {uint8_t *} cmdData
 * @return {*}
 */
int sxk_callback_27(struct cmdDataType* cmd,uint8_t * cmdData)
{
    if(cmd == nullptr && cmdData == nullptr) {
        qlog_e("SxkCmd27::读取HMC7044指令为空.");
        return -1;
    }
    
    struct cmdDataType m_replay;
    memcpy(&m_replay,cmd,sizeof(struct cmdDataType));
    m_replay.source_DevType = cmd->dst_DevType;
    m_replay.source_DevNum = cmd->dst_DevNum;
    m_replay.dst_DevType = cmd->source_DevType;
    m_replay.dst_DevNum = cmd->source_DevNum;
    uint16_t replayData[2];
    uint16_t reg = *(uint16_t *)cmdData;
    uint8_t value = 0;
    
    value = hmc7044ReadReg(reg);
    qlog_n("HMC7044 地址读:%#x,值：%#x",reg,value);
    m_replay.DevStatus = CMD_OK;
    m_replay.dataLen = 4;
    replayData[0] = reg;
    replayData[1] = value;
    return Server::Instance().separate(s_sds,1,&m_replay,(uint8_t *)replayData);
}

/*** 
 * @description: 设置HMC7044寄存器
 * @param {cmdDataType*} cmd
 * @param {uint8_t *} cmdData
 * @return {*}
 */
int sxk_callback_28(struct cmdDataType* cmd,uint8_t * cmdData)
{
    if(cmd == nullptr && cmdData == nullptr) {
        qlog_e("SxkCmd28::写入HMC7044指令为空.");
        return -1;
    }
    struct cmdDataType m_replay;
    memcpy(&m_replay,cmd,sizeof(struct cmdDataType));
    m_replay.source_DevType = cmd->dst_DevType;
    m_replay.source_DevNum = cmd->dst_DevNum;
    m_replay.dst_DevType = cmd->source_DevType;
    m_replay.dst_DevNum = cmd->source_DevNum;
    uint16_t reg = *(uint16_t *)cmdData;
    uint8_t value = *(uint16_t *)(cmdData+2);
    qlog_n("HMC7044 地址写入:%#x.",reg);
    hmc7044SetReg(reg,value);
    m_replay.DevStatus = CMD_OK;

    return Server::Instance().separate(s_sds,1,&m_replay,cmdData);
     
}

/*** 
 * @description: 读取SI5341寄存器
 * @param {cmdDataType*} cmd
 * @param {uint8_t *} cmdData
 * @return {*}
 */
int sxk_callback_29(struct cmdDataType* cmd,uint8_t * cmdData)
{
    if(cmd == nullptr && cmdData == nullptr) {
        qlog_e("SxkCmd29::读取SI5341指令为空.");
        return -1;
    }
    
    struct cmdDataType m_replay;
    memcpy(&m_replay,cmd,sizeof(struct cmdDataType));
    m_replay.source_DevType = cmd->dst_DevType;
    m_replay.source_DevNum = cmd->dst_DevNum;
    m_replay.dst_DevType = cmd->source_DevType;
    m_replay.dst_DevNum = cmd->source_DevNum;
    uint16_t replayData[2];
    uint16_t reg = *(uint16_t *)cmdData;
    uint8_t value = 0;
    
    value = si5341ReadReg(reg);
    qlog_n("SI5341 地址读:%#x,值：%#x",reg,value);
    m_replay.DevStatus = CMD_OK;
    m_replay.dataLen = 4;
    replayData[0] = reg;
    replayData[1] = value;
    return Server::Instance().separate(s_sds,1,&m_replay,(uint8_t *)replayData);
}

/*** 
 * @description: 设置SI5341寄存器
 * @param {cmdDataType*} cmd
 * @param {uint8_t *} cmdData
 * @return {*}
 */
int sxk_callback_30(struct cmdDataType* cmd,uint8_t * cmdData)
{
    if(cmd == nullptr && cmdData == nullptr) {
        qlog_e("SxkCmd30::写入SI5341指令为空.");
        return -1;
    }
    struct cmdDataType m_replay;
    memcpy(&m_replay,cmd,sizeof(struct cmdDataType));
    m_replay.source_DevType = cmd->dst_DevType;
    m_replay.source_DevNum = cmd->dst_DevNum;
    m_replay.dst_DevType = cmd->source_DevType;
    m_replay.dst_DevNum = cmd->source_DevNum;
    uint16_t reg = *(uint16_t *)cmdData;
    uint8_t value = *(uint16_t *)(cmdData+2);
    qlog_n("SI5341 地址写入:%#x.",reg);
    si5341SetReg(reg,value);
    m_replay.DevStatus = CMD_OK;

    return Server::Instance().separate(s_sds,1,&m_replay,cmdData);
     
}

/*** 
 * @description: 配置接收校准自动补平标准值
 * @param {cmdDataType*} cmd
 * @param {uint8_t *} cmdData
 * @return {*}
 */
int sxk_callback_31(struct cmdDataType* cmd,uint8_t * cmdData)
{
    if(cmd == nullptr && cmdData == nullptr) {
        qlog_e("SxkCmd31::接收校准自动补平标准值指令为空.");
        return -1;
    }
    string str;
    int ret = 0;

    uint16_t hRecvStandard[2][2];//接收自动手动标准值系数 两个频点，先幅度后相位
    uint16_t vRecvStandard[2][2];//接收自动手动标准值系数

    memcpy((uint8_t *)hRecvStandard,cmdData,sizeof(hRecvStandard));
    memcpy((uint8_t *)vRecvStandard,cmdData+sizeof(hRecvStandard),sizeof(vRecvStandard));
    qlog_i("频点0,H极化接收标准值:amp=%d,phase=%d.",hRecvStandard[0][0],hRecvStandard[0][1]);
    qlog_i("频点1,H极化接收标准值:amp=%d,phase=%d.",hRecvStandard[1][0],hRecvStandard[0][1]);
    qlog_i("频点0,V极化接收标准值:amp=%d,phase=%d.",vRecvStandard[0][0],vRecvStandard[0][1]);
    qlog_i("频点1,V极化接收标准值:amp=%d,phase=%d.",vRecvStandard[1][0],vRecvStandard[1][1]);

    for(int i = 0;i<32;i++) {
        recvMulitFreqStr.hRecvAmp[0][i] = hRecvStandard[0][0];
        recvMulitFreqStr.hRecvPhase[0][i] = hRecvStandard[0][1];

        recvMulitFreqStr.hRecvAmp[1][i] = hRecvStandard[1][0];
        recvMulitFreqStr.hRecvPhase[1][i] = hRecvStandard[1][1];

        recvMulitFreqStr.vRecvAmp[0][i] = vRecvStandard[0][0];
        recvMulitFreqStr.vRecvPhase[0][i] = vRecvStandard[0][1];

        recvMulitFreqStr.vRecvAmp[1][i] = vRecvStandard[1][0];
        recvMulitFreqStr.vRecvPhase[1][i] = vRecvStandard[1][1];
    }

    str = Conf::currentConf()->mFilePath.uFreqReferencePath + string("/") + _RECV_REFERENCE_VALUE_;

    ret = WriteFile(str.c_str(),(unsigned char *)&recvMulitFreqStr,sizeof(recvMulitFreqStr));
    if(ret < 0) {
        qlog_e("接收校准标准值写入错误,%s.",str.c_str());
    }
    return Server::Instance().responseSds(cmd);
}

/*** 
 * @description: 读取接收校准自动补平标准值
 * @param {cmdDataType*} cmd
 * @param {uint8_t *} cmdData
 * @return {*}
 */
int sxk_callback_32(struct cmdDataType* cmd,uint8_t * cmdData)
{
    uint16_t Standard[2][4];   //HV极化每组2个频点
    struct cmdDataType m_replay;
    memcpy(&m_replay,cmd,sizeof(struct cmdDataType));
    m_replay.source_DevType = cmd->dst_DevType;
    m_replay.source_DevNum = cmd->dst_DevNum;
    m_replay.dst_DevType = cmd->source_DevType;
    m_replay.dst_DevNum = cmd->source_DevNum;
    m_replay.dataLen = sizeof(Standard);
    m_replay.DevStatus = CMD_OK;
    Standard[0][0] = recvMulitFreqStr.hRecvAmp[0][0];
    Standard[0][1] = recvMulitFreqStr.hRecvPhase[0][0];
    Standard[0][2] = recvMulitFreqStr.hRecvAmp[1][0];
    Standard[0][3] = recvMulitFreqStr.hRecvPhase[1][0];

    Standard[1][0] = recvMulitFreqStr.vRecvAmp[0][0];
    Standard[1][1] = recvMulitFreqStr.vRecvPhase[0][0];
    Standard[1][2] = recvMulitFreqStr.vRecvAmp[1][0];
    Standard[1][3] = recvMulitFreqStr.vRecvPhase[1][0];
    
    qlog_i("读取接收校准标准值.");
    return Server::Instance().separate(s_sds,1,&m_replay,(uint8_t *)&Standard);
}

/*** 
 * @description: 读取发射校准标准值 
 * @param {cmdDataType*} cmd
 * @param {uint8_t *} cmdData
 * @return {*}
 */
int sxk_callback_33(struct cmdDataType* cmd,uint8_t * cmdData)
{
    struct cmdDataType m_replay;
    memcpy(&m_replay,cmd,sizeof(struct cmdDataType));
    m_replay.source_DevType = cmd->dst_DevType;
    m_replay.source_DevNum = cmd->dst_DevNum;
    m_replay.dst_DevType = cmd->source_DevType;
    m_replay.dst_DevNum = cmd->source_DevNum;
    m_replay.dataLen = sizeof(mulitFreqStr);
    m_replay.DevStatus = CMD_OK;
    qlog_i("读取发射校准标准值.");
    return Server::Instance().separate(s_sds,1,&m_replay,(uint8_t *)&mulitFreqStr);
}

/*** 
 * @description: 读取发射耦合系数
 * @param {cmdDataType*} cmd
 * @param {uint8_t *} cmdData
 * @return {*}
 */
int sxk_callback_34(struct cmdDataType* cmd,uint8_t * cmdData)
{
    struct cmdDataType m_replay;
    uint8_t buffer[1024];
    memcpy(&m_replay,cmd,sizeof(struct cmdDataType));
    m_replay.source_DevType = cmd->dst_DevType;
    m_replay.source_DevNum = cmd->dst_DevNum;
    m_replay.dst_DevType = cmd->source_DevType;
    m_replay.dst_DevNum = cmd->source_DevNum;
    m_replay.dataLen = sizeof(hCoefficient)*2;
    m_replay.DevStatus = CMD_OK;
    memcpy(buffer,(unsigned char *)hCoefficient,sizeof(hCoefficient));
    memcpy(&buffer[sizeof(hCoefficient)],(unsigned char *)vCoefficient,sizeof(vCoefficient));
    qlog_i("读取发射耦合系数.");
    return Server::Instance().separate(s_sds,1,&m_replay,buffer);
}

/*** 
 * @description: 读取TBF校准标准值 
 * @param {cmdDataType*} cmd
 * @param {uint8_t *} cmdData
 * @return {*}
 */
int sxk_callback_35(struct cmdDataType* cmd,uint8_t * cmdData)
{
    struct cmdDataType m_replay;
    memcpy(&m_replay,cmd,sizeof(struct cmdDataType));
    m_replay.source_DevType = cmd->dst_DevType;
    m_replay.source_DevNum = cmd->dst_DevNum;
    m_replay.dst_DevType = cmd->source_DevType;
    m_replay.dst_DevNum = cmd->source_DevNum;
    m_replay.dataLen = sizeof(tbf_mulitFreqStr);
    m_replay.DevStatus = CMD_OK;

    qlog_i("读取TBF校准标准值.");
    return Server::Instance().separate(s_sds,1,&m_replay,(unsigned char *)&tbf_mulitFreqStr);
}

/*** 
 * @description: 读取TBF耦合系数
 * @param {cmdDataType*} cmd
 * @param {uint8_t *} cmdData
 * @return {*}
 */
int sxk_callback_36(struct cmdDataType* cmd,uint8_t * cmdData)
{
    struct cmdDataType m_replay;
    uint8_t buffer[1024];
    memcpy(&m_replay,cmd,sizeof(struct cmdDataType));
    m_replay.source_DevType = cmd->dst_DevType;
    m_replay.source_DevNum = cmd->dst_DevNum;
    m_replay.dst_DevType = cmd->source_DevType;
    m_replay.dst_DevNum = cmd->source_DevNum;
    m_replay.dataLen = sizeof(hCoefficient)*2;
    m_replay.DevStatus = CMD_OK;

    memcpy(buffer,(unsigned char *)hCoefficient,sizeof(hCoefficient));
    memcpy(&buffer[sizeof(vCoefficient)],(unsigned char *)vCoefficient,sizeof(vCoefficient));
    qlog_i("读取TBF耦合系数.");
    return Server::Instance().separate(s_sds,1,&m_replay,buffer);

}

/**
 * @brief: 雷达PL复位
 * @return {*}
 */
int global_callback_0(struct cmdDataType* cmd,uint8_t * cmdData)
{
    if(cmd == nullptr) {
        qlog_e("globalCmd0::m_data is null..");
        return -1;
    }
    qlog_i("x05 Radar pl reset..");
    
    Server::Instance().m_sxk.resetInit(m_all);

    struct cmdDataType m_replay;
    memcpy(&m_replay,cmd,sizeof(struct cmdDataType));
    m_replay.dataLen = 0;
    Server::Instance().separate(s_sds,1,&m_replay,cmdData);
    return 0;
}
/*** 
 * @description: PS复位
 * @param {cmdDataType*} cmd
 * @param {uint8_t *} cmdData
 * @return {*}
 */
int global_callback_1(struct cmdDataType* cmd,uint8_t * cmdData)
{
    if(cmd == nullptr) {
        qlog_e("globalCmd1::m_data is null..");
        return -1;
    }
    qlog_i("x05 Radar ps reset..");
    Server::Instance().m_sxk.psReset();

    struct cmdDataType m_replay;
    memcpy(&m_replay,cmd,sizeof(struct cmdDataType));
    m_replay.dataLen = 0;
    Server::Instance().separate(s_sds,1,&m_replay,cmdData);
    return 0;
}
/*** 
 * @description: 雷达工作频率
 * @param {cmdDataType*} cmd
 * @param {uint8_t *} cmdData
 * @return {*}
 */
int global_callback_2(struct cmdDataType* cmd,uint8_t * cmdData)
{
    return 0;
}
/*** 
 * @description: TR通道开关
 * @param {cmdDataType*} cmd
 * @param {uint8_t *} cmdData
 * @return {*}
 */
int global_callback_3(struct cmdDataType* cmd,uint8_t * cmdData)
{
    return 0;
}
/*** 
 * @description: 日志等级
 * @param {cmdDataType*} cmd
 * @param {uint8_t *} cmdData
 * @return {*}
 */
int global_callback_4(struct cmdDataType* cmd,uint8_t * cmdData)
{
    qlog_w("配置日志等级:%d",*cmdData);
    //初始化日志输出级别
	_SETLOG_LEVEL_(*cmdData);
    int level = *cmdData;
    struct cmdDataType m_replay;
    memcpy(&m_replay,cmd,sizeof(struct cmdDataType));
    m_replay.dataLen = 0;
    m_replay.source_DevType = CurDeviceType;
    m_replay.source_DevNum = ComponentNO;
    m_replay.dst_DevType =  CENTER_SERVER_Sub_Unit_S;
    m_replay.dst_DevNum = 0;
    writeIntValue("logConfig","logOutLevel",level,Server::Instance().m_configPath.c_str());
    return Server::Instance().separate(s_sds,1,&m_replay,cmdData);
}

int global_callback_5(struct cmdDataType* cmd,uint8_t * cmdData)
{
    return 0;
}

int global_callback_6(struct cmdDataType* cmd,uint8_t * cmdData)
{
    return 0;
}

int global_callback_7(struct cmdDataType* cmd,uint8_t * cmdData)
{
    return 0;
}

int global_callback_8(struct cmdDataType* cmd,uint8_t * cmdData)
{
    return 0;
}



//指向固定角度（水平）
int sxkMotor_callback_0(struct cmdDataType* cmd,uint8_t * cmdData)
{
    if(cmd->dataLen < 0){
        return -1;
    }
    struct cmdDataType cmdHeader;
    uint16_t sendnum = 0xFFFF;  
    Server::Instance().m_sxk.m_servo->H_ConfigServo.servo_turn_switches = 1;
    Server::Instance().m_sxk.m_servo->H_ConfigServo.servo_point_angle = *(uint16_t *)cmdData;

    if(Server::Instance().m_sxk.m_servo->servoPackage_2() > 0){
        cmdHeader.DeviceType = t_serverReplyCmd;
        cmdHeader.source_DevType = CurDeviceType;
        cmdHeader.source_DevNum = ComponentNO;
        cmdHeader.dst_DevType =  CENTER_SERVER_Sub_Unit_S;
        cmdHeader.dst_DevNum = 0;
        cmdHeader.cmdType = cmd->cmdType;
        cmdHeader.cmdChildType = cmd->cmdChildType;
        cmdHeader.DevStatus = 0;
        cmdHeader.dataLen = 0;
        Server::Instance().separate(s_sds,sendnum,&cmdHeader,cmdData);
        return 0;
    }
    return -1;

}
//转台转速设定（水平）
int sxkMotor_callback_1(struct cmdDataType* cmd,uint8_t * cmdData)
{
    if(cmd->dataLen < 0){
        return -1;
    }
    struct cmdDataType cmdHeader;
    uint16_t sendnum = 0;  
    Server::Instance().m_sxk.m_servo->H_ConfigServo.servo_turn_switches = 1;
    Server::Instance().m_sxk.m_servo->H_ConfigServo.servo_cw_speed = *(uint16_t *)cmdData;

    if(Server::Instance().m_sxk.m_servo->servoPackage_4() > 0){
        cmdHeader.DeviceType = t_serverReplyCmd;
        cmdHeader.source_DevType = CurDeviceType;
        cmdHeader.source_DevNum = ComponentNO;
        cmdHeader.dst_DevType =  CENTER_SERVER_Sub_Unit_S;
        cmdHeader.dst_DevNum = 0;
        cmdHeader.cmdType = cmd->cmdType;
        cmdHeader.cmdChildType = cmd->cmdChildType;
        cmdHeader.DevStatus = 0;
        cmdHeader.dataLen = 0;
        Server::Instance().separate(s_sds,sendnum,&cmdHeader,cmdData);
        return 0;
    }
    return -1;
}
//转台循环转动（水平）
int sxkMotor_callback_2(struct cmdDataType* cmd,uint8_t * cmdData)
{
    if(cmd->dataLen < 0){
        return -1;
    }
    struct cmdDataType cmdHeader;
    uint16_t sendnum = 0;  
    Server::Instance().m_sxk.m_servo->H_ConfigServo.servo_turn_switches = 1;
    Server::Instance().m_sxk.m_servo->H_ConfigServo.servo_start_cycle_angle = *(uint16_t *)cmdData;
    Server::Instance().m_sxk.m_servo->H_ConfigServo.servo_end_cycle_angle = *(uint16_t *)(cmdData + 2);
    Server::Instance().m_sxk.m_servo->H_ConfigServo.servo_cycle_count = *(uint16_t *)(cmdData + 4);

    if(Server::Instance().m_sxk.m_servo->servoPackage_5() > 0){
        cmdHeader.DeviceType = t_serverReplyCmd;
        cmdHeader.source_DevType = CurDeviceType;
        cmdHeader.source_DevNum = ComponentNO;
        cmdHeader.dst_DevType =  CENTER_SERVER_Sub_Unit_S;
        cmdHeader.dst_DevNum = 0;
        cmdHeader.cmdType = cmd->cmdType;
        cmdHeader.cmdChildType = cmd->cmdChildType;
        cmdHeader.DevStatus = 0;
        cmdHeader.dataLen = 0;
        Server::Instance().separate(s_sds,sendnum,&cmdHeader,cmdData);
        return 0;
    }
    return -1;
}
//转台匀速转动（水平）
int sxkMotor_callback_3(struct cmdDataType* cmd,uint8_t * cmdData)
{
    if(cmd->dataLen < 0){
        return -1;
    }
    struct cmdDataType cmdHeader;
    uint16_t sendnum = 0;  
    Server::Instance().m_sxk.m_servo->H_ConfigServo.servo_turn_switches = 1;
    Server::Instance().m_sxk.m_servo->H_ConfigServo.servo_cw_speed = *(uint16_t *)cmdData;
    Server::Instance().m_sxk.m_servo->H_ConfigServo.start_turn_hours = *(cmdData + 2);
    Server::Instance().m_sxk.m_servo->H_ConfigServo.start_turn_min = *(cmdData + 3);
    Server::Instance().m_sxk.m_servo->H_ConfigServo.start_turn_sec = *(cmdData + 4);

    if(Server::Instance().m_sxk.m_servo->servoPackage_1() > 0){
        cmdHeader.DeviceType = t_serverReplyCmd;
        cmdHeader.source_DevType = CurDeviceType;
        cmdHeader.source_DevNum = ComponentNO;
        cmdHeader.dst_DevType =  CENTER_SERVER_Sub_Unit_S;
        cmdHeader.dst_DevNum = 0;
        cmdHeader.cmdType = cmd->cmdType;
        cmdHeader.cmdChildType = cmd->cmdChildType;
        cmdHeader.DevStatus = 0;
        cmdHeader.dataLen = 0;
        Server::Instance().separate(s_sds,sendnum,&cmdHeader,cmdData);
        return 0;
    }
    return -1;
}
//转台停止转动（水平）
int sxkMotor_callback_4(struct cmdDataType* cmd,uint8_t * cmdData)
{
    if(cmd->dataLen < 0){
        return -1;
    }
    struct cmdDataType cmdHeader;
    uint16_t sendnum = 0;  
    Server::Instance().m_sxk.m_servo->H_ConfigServo.servo_turn_switches = 0;

    if(Server::Instance().m_sxk.m_servo->servoPackage_6() > 0){
        cmdHeader.DeviceType = t_serverReplyCmd;
        cmdHeader.source_DevType = CurDeviceType;
        cmdHeader.source_DevNum = ComponentNO;
        cmdHeader.dst_DevType =  CENTER_SERVER_Sub_Unit_S;
        cmdHeader.dst_DevNum = 0;
        cmdHeader.cmdType = cmd->cmdType;
        cmdHeader.cmdChildType = cmd->cmdChildType;
        cmdHeader.DevStatus = 0;
        cmdHeader.dataLen = 0;
        Server::Instance().separate(s_sds,sendnum,&cmdHeader,cmdData);
        return 0;
    }
    return -1;
}

//转台回转至0°（水平）
int sxkMotor_callback_5(struct cmdDataType* cmd,uint8_t * cmdData)
{
    if(cmd->dataLen < 0){
        return -1;
    }
    struct cmdDataType cmdHeader;
    uint16_t sendnum = 0;  
    Server::Instance().m_sxk.m_servo->H_ConfigServo.servo_turn_switches = 1;
    Server::Instance().m_sxk.m_servo->H_ConfigServo.servo_to_zero = 1;

    if(Server::Instance().m_sxk.m_servo->servoPackage_12() > 0){
        cmdHeader.DeviceType = t_serverReplyCmd;
        cmdHeader.source_DevType = CurDeviceType;
        cmdHeader.source_DevNum = ComponentNO;
        cmdHeader.dst_DevType =  CENTER_SERVER_Sub_Unit_S;
        cmdHeader.dst_DevNum = 0;
        cmdHeader.cmdType = cmd->cmdType;
        cmdHeader.cmdChildType = cmd->cmdChildType;
        cmdHeader.DevStatus = 0;
        cmdHeader.dataLen = 0;
        return Server::Instance().separate(s_sds,sendnum,&cmdHeader,cmdData);
    }
    return -1;
}
//获取当前转台状态
int sxkMotor_callback_6(struct cmdDataType* cmd,uint8_t * cmdData)
{
    if(cmd->dataLen < 0){
        return -1;
    }
    static uint8_t motorStatus[35] = { 0 };
    struct cmdDataType cmdHeader;
    uint16_t sendnum = 0;  
    cmdHeader.DeviceType = t_serverReplyCmd;
    cmdHeader.source_DevType = CurDeviceType;
    cmdHeader.source_DevNum = ComponentNO;
    cmdHeader.dst_DevType =  CENTER_SERVER_Sub_Unit_S;
    cmdHeader.dst_DevNum = 0;
    cmdHeader.cmdType = cmd->cmdType;
    cmdHeader.cmdChildType = cmd->cmdChildType;
    cmdHeader.DevStatus = 0;
    cmdHeader.dataLen = sizeof(Server::Instance().m_sxk.m_servo->H_ConfigServo.m_status);//27字节
    memcpy(motorStatus,&Server::Instance().m_sxk.m_servo->H_ConfigServo.m_status,sizeof(motorStatus));
    Server::Instance().separate(s_sds,sendnum,&cmdHeader,motorStatus);
    memset(motorStatus,0,sizeof(motorStatus));

    // Server::Instance().m_sxk.m_servo->servoPackage_e1();//开启正常协议
    return 0;
}
//伺服校0
int sxkMotor_callback_7(struct cmdDataType* cmd,uint8_t * cmdData)
{
    if(cmd->dataLen < 0){
        return -1;
    }
    struct cmdDataType cmdHeader;
    uint16_t sendnum = 0;  
    Server::Instance().m_sxk.m_servo->H_ConfigServo.servo_turn_switches = 0;
    Server::Instance().m_sxk.m_servo->H_ConfigServo.servo_cali_0 = 1;
    if(Server::Instance().m_sxk.m_servo->servoPackage_11() > 0){
        cmdHeader.DeviceType = t_serverReplyCmd;
        cmdHeader.source_DevType = CurDeviceType;
        cmdHeader.source_DevNum = ComponentNO;
        cmdHeader.dst_DevType =  CENTER_SERVER_Sub_Unit_S;
        cmdHeader.dst_DevNum = 0;
        cmdHeader.cmdType = cmd->cmdType;
        cmdHeader.cmdChildType = cmd->cmdChildType;
        cmdHeader.DevStatus = 0;
        cmdHeader.dataLen = 0;
        return Server::Instance().separate(s_sds,sendnum,&cmdHeader,cmdData);
    }
    return -1;
}
//逆时针转动（水平）
int sxkMotor_callback_8(struct cmdDataType* cmd,uint8_t * cmdData)
{
    if(cmd->dataLen < 0){
        return -1;
    }
    struct cmdDataType cmdHeader;
    uint16_t sendnum = 0;  
    Server::Instance().m_sxk.m_servo->H_ConfigServo.servo_turn_switches = 1;
    Server::Instance().m_sxk.m_servo->H_ConfigServo.servo_ccw_speed = *(uint16_t *)cmdData;
    Server::Instance().m_sxk.m_servo->H_ConfigServo.start_turn_hours = *(cmdData+2);
    Server::Instance().m_sxk.m_servo->H_ConfigServo.start_turn_min = *(cmdData+3);
    Server::Instance().m_sxk.m_servo->H_ConfigServo.start_turn_sec = *(cmdData+4);


    if(Server::Instance().m_sxk.m_servo->servoPackage_13() > 0){
        cmdHeader.DeviceType = t_serverReplyCmd;
        cmdHeader.source_DevType = CurDeviceType;
        cmdHeader.source_DevNum = ComponentNO;
        cmdHeader.dst_DevType =  CENTER_SERVER_Sub_Unit_S;
        cmdHeader.dst_DevNum = 0;
        cmdHeader.cmdType = cmd->cmdType;
        cmdHeader.cmdChildType = cmd->cmdChildType;
        cmdHeader.DevStatus = 0;
        cmdHeader.dataLen = 0;
        return Server::Instance().separate(s_sds,sendnum,&cmdHeader,cmdData);
    }
    return -1;
}
//扇扫模式
int sxkMotor_callback_9(struct cmdDataType* cmd,uint8_t * cmdData)
{
    if(cmd->dataLen < 0){
        return -1;
    }
    // struct cmdDataType cmdHeader;
    // uint16_t sendnum = 0;  
    Server::Instance().m_sxk.m_servo->H_ConfigServo.servo_turn_switches = 1;
    Server::Instance().m_sxk.m_servo->H_ConfigServo.fan_scan_mode = 1;

    // if(Server::Instance().m_sxk.m_servo->motor_protocol_package(cmd->cmdChildType) > 0){
    //     cmdHeader.DeviceType = t_serverReplyCmd;
    //     cmdHeader.source_DevType = CurDeviceType;
    //     cmdHeader.source_DevNum = ComponentNO;
    //     cmdHeader.dst_DevType =  CENTER_SERVER_Sub_Unit_S;
    //     cmdHeader.dst_DevNum = 0;
    //     cmdHeader.cmdType = cmd->cmdType;
    //     cmdHeader.cmdChildType = cmd->cmdChildType;
    //     cmdHeader.DevStatus = 0;
    //     cmdHeader.dataLen = 0;
    //     Server::Instance().separate(s_sds,sendnum,&cmdHeader,cmdData);
    //     return 0;
    // }
    return -1;
}
//固定角度命令（俯仰）
int sxkMotor_callback_10(struct cmdDataType* cmd,uint8_t * cmdData)
{
    if(cmd->dataLen < 0){
        return -1;
    }
    struct cmdDataType cmdHeader;
    uint16_t sendnum = 0;  
    Server::Instance().m_sxk.m_servo->V_ConfigServo.servo_turn_switches = 1;
    Server::Instance().m_sxk.m_servo->V_ConfigServo.servo_point_angle = *(uint16_t *)cmdData;

    if(Server::Instance().m_sxk.m_servo->servoPackage_a2() > 0){
        cmdHeader.DeviceType = t_serverReplyCmd;
        cmdHeader.source_DevType = CurDeviceType;
        cmdHeader.source_DevNum = ComponentNO;
        cmdHeader.dst_DevType =  CENTER_SERVER_Sub_Unit_S;
        cmdHeader.dst_DevNum = 0;
        cmdHeader.cmdType = cmd->cmdType;
        cmdHeader.cmdChildType = cmd->cmdChildType;
        cmdHeader.DevStatus = 0;
        cmdHeader.dataLen = 0;
        return Server::Instance().separate(s_sds,sendnum,&cmdHeader,cmdData);
    }
    return -1;
}
//循环转动（俯仰）
int sxkMotor_callback_11(struct cmdDataType* cmd,uint8_t * cmdData)
{
    if(cmd->dataLen < 0){
        return -1;
    }
    struct cmdDataType cmdHeader;
    uint16_t sendnum = 0;  
    Server::Instance().m_sxk.m_servo->V_ConfigServo.servo_turn_switches = 1;
    Server::Instance().m_sxk.m_servo->V_ConfigServo.servo_start_cycle_angle = *(uint16_t *)cmdData;
    Server::Instance().m_sxk.m_servo->V_ConfigServo.servo_end_cycle_angle = *(uint16_t *)(cmdData+2);
    Server::Instance().m_sxk.m_servo->V_ConfigServo.servo_cycle_count = *(uint16_t *)(cmdData+4);

    if(Server::Instance().m_sxk.m_servo->servoPackage_a3() > 0){
        cmdHeader.DeviceType = t_serverReplyCmd;
        cmdHeader.source_DevType = CurDeviceType;
        cmdHeader.source_DevNum = ComponentNO;
        cmdHeader.dst_DevType =  CENTER_SERVER_Sub_Unit_S;
        cmdHeader.dst_DevNum = 0;
        cmdHeader.cmdType = cmd->cmdType;
        cmdHeader.cmdChildType = cmd->cmdChildType;
        cmdHeader.DevStatus = 0;
        cmdHeader.dataLen = 0;
        return Server::Instance().separate(s_sds,sendnum,&cmdHeader,cmdData);
    }
    return -1;
}
//转速设定（俯仰）
int sxkMotor_callback_12(struct cmdDataType* cmd,uint8_t * cmdData)
{
    if(cmd->dataLen < 0){
        return -1;
    }
    struct cmdDataType cmdHeader;
    uint16_t sendnum = 0;  
    Server::Instance().m_sxk.m_servo->V_ConfigServo.servo_turn_switches = 1;
    Server::Instance().m_sxk.m_servo->V_ConfigServo.servo_cw_speed = *(uint16_t *)cmdData;

    if(Server::Instance().m_sxk.m_servo->servoPackage_a4() > 0){
        cmdHeader.DeviceType = t_serverReplyCmd;
        cmdHeader.source_DevType = CurDeviceType;
        cmdHeader.source_DevNum = ComponentNO;
        cmdHeader.dst_DevType =  CENTER_SERVER_Sub_Unit_S;
        cmdHeader.dst_DevNum = 0;
        cmdHeader.cmdType = cmd->cmdType;
        cmdHeader.cmdChildType = cmd->cmdChildType;
        cmdHeader.DevStatus = 0;
        cmdHeader.dataLen = 0;
        return Server::Instance().separate(s_sds,sendnum,&cmdHeader,cmdData);
    }
    return -1;
}
//转台停止转动（俯仰）
int sxkMotor_callback_13(struct cmdDataType* cmd,uint8_t * cmdData)
{
    if(cmd->dataLen < 0){
        return -1;
    }
    struct cmdDataType cmdHeader;
    uint16_t sendnum = 0;  
    Server::Instance().m_sxk.m_servo->V_ConfigServo.servo_turn_switches = 0;

    if(Server::Instance().m_sxk.m_servo->servoPackage_b4() > 0){
        cmdHeader.DeviceType = t_serverReplyCmd;
        cmdHeader.source_DevType = CurDeviceType;
        cmdHeader.source_DevNum = ComponentNO;
        cmdHeader.dst_DevType =  CENTER_SERVER_Sub_Unit_S;
        cmdHeader.dst_DevNum = 0;
        cmdHeader.cmdType = cmd->cmdType;
        cmdHeader.cmdChildType = cmd->cmdChildType;
        cmdHeader.DevStatus = 0;
        cmdHeader.dataLen = 0;
        return Server::Instance().separate(s_sds,sendnum,&cmdHeader,cmdData);
    }
    return -1;
}
//回转至30°命令（俯仰）
int sxkMotor_callback_14(struct cmdDataType* cmd,uint8_t * cmdData)
{
    if(cmd->dataLen < 0){
        return -1;
    }
    struct cmdDataType cmdHeader;
    uint16_t sendnum = 0;  
    Server::Instance().m_sxk.m_servo->V_ConfigServo.servo_turn_switches = 1;
    Server::Instance().m_sxk.m_servo->V_ConfigServo.servo_to_30 = 1;

    if(Server::Instance().m_sxk.m_servo->servoPackage_b2() > 0){
        cmdHeader.DeviceType = t_serverReplyCmd;
        cmdHeader.source_DevType = CurDeviceType;
        cmdHeader.source_DevNum = ComponentNO;
        cmdHeader.dst_DevType =  CENTER_SERVER_Sub_Unit_S;
        cmdHeader.dst_DevNum = 0;
        cmdHeader.cmdType = cmd->cmdType;
        cmdHeader.cmdChildType = cmd->cmdChildType;
        cmdHeader.DevStatus = 0;
        cmdHeader.dataLen = 0;
        return Server::Instance().separate(s_sds,sendnum,&cmdHeader,cmdData);
    }
    return -1;
}
//伺服校30（俯仰）
int sxkMotor_callback_15(struct cmdDataType* cmd,uint8_t * cmdData)
{
    if(cmd->dataLen < 0){
        return -1;
    }
    struct cmdDataType cmdHeader;
    uint16_t sendnum = 0;  
    Server::Instance().m_sxk.m_servo->V_ConfigServo.servo_turn_switches = 0;
    Server::Instance().m_sxk.m_servo->V_ConfigServo.servo_cali_30 = 1;

    if(Server::Instance().m_sxk.m_servo->servoPackage_b1() > 0){
        cmdHeader.DeviceType = t_serverReplyCmd;
        cmdHeader.source_DevType = CurDeviceType;
        cmdHeader.source_DevNum = ComponentNO;
        cmdHeader.dst_DevType =  CENTER_SERVER_Sub_Unit_S;
        cmdHeader.dst_DevNum = 0;
        cmdHeader.cmdType = cmd->cmdType;
        cmdHeader.cmdChildType = cmd->cmdChildType;
        cmdHeader.DevStatus = 0;
        cmdHeader.dataLen = 0;
        return Server::Instance().separate(s_sds,sendnum,&cmdHeader,cmdData);
    }
    return -1;
}
int sxkMotor_callback_16(struct cmdDataType* cmd,uint8_t * cmdData)
{
    return 0;
}
int sxkMotor_callback_17(struct cmdDataType* cmd,uint8_t * cmdData)
{
    return 0;
}
int sxkMotor_callback_18(struct cmdDataType* cmd,uint8_t * cmdData)
{
    return 0;
}
int sxkMotor_callback_19(struct cmdDataType* cmd,uint8_t * cmdData)
{
    return 0;
}
int sxkMotor_callback_20(struct cmdDataType* cmd,uint8_t * cmdData)
{
    return 0;
}
//加速度设置命令（水平）
int sxkMotor_callback_21(struct cmdDataType* cmd,uint8_t * cmdData)
{
    if(cmd->dataLen < 0){
        return -1;
    }
    struct cmdDataType cmdHeader;
    uint16_t sendnum = 0;  
    Server::Instance().m_sxk.m_servo->H_ConfigServo.servo_turn_switches = 1;
    Server::Instance().m_sxk.m_servo->H_ConfigServo.servo_accel = *(uint16_t *)cmdData;

    if(Server::Instance().m_sxk.m_servo->servoPackage_b3() > 0){
        cmdHeader.DeviceType = t_serverReplyCmd;
        cmdHeader.source_DevType = CurDeviceType;
        cmdHeader.source_DevNum = ComponentNO;
        cmdHeader.dst_DevType =  CENTER_SERVER_Sub_Unit_S;
        cmdHeader.dst_DevNum = 0;
        cmdHeader.cmdType = cmd->cmdType;
        cmdHeader.cmdChildType = cmd->cmdChildType;
        cmdHeader.DevStatus = 0;
        cmdHeader.dataLen = 0;
        return Server::Instance().separate(s_sds,sendnum,&cmdHeader,cmdData);
    }
    return -1;
}

//加速度设置命令（俯仰）
int sxkMotor_callback_22(struct cmdDataType* cmd,uint8_t * cmdData)
{
    if(cmd->dataLen < 0){
        return -1;
    }
    struct cmdDataType cmdHeader;
    uint16_t sendnum = 0;  
    Server::Instance().m_sxk.m_servo->V_ConfigServo.servo_turn_switches = 1;
    Server::Instance().m_sxk.m_servo->V_ConfigServo.servo_accel = *(uint16_t *)cmdData;

    if(Server::Instance().m_sxk.m_servo->servoPackage_c3() > 0){
        cmdHeader.DeviceType = t_serverReplyCmd;
        cmdHeader.source_DevType = CurDeviceType;
        cmdHeader.source_DevNum = ComponentNO;
        cmdHeader.dst_DevType =  CENTER_SERVER_Sub_Unit_S;
        cmdHeader.dst_DevNum = 0;
        cmdHeader.cmdType = cmd->cmdType;
        cmdHeader.cmdChildType = cmd->cmdChildType;
        cmdHeader.DevStatus = 0;
        cmdHeader.dataLen = 0;
        return Server::Instance().separate(s_sds,sendnum,&cmdHeader,cmdData);
    }
    return -1;
}
int sxkMotor_callback_23(struct cmdDataType* cmd,uint8_t * cmdData)
{
    return 0;
}
int sxkMotor_callback_24(struct cmdDataType* cmd,uint8_t * cmdData)
{
    return 0;
}
int sxkMotor_callback_25(struct cmdDataType* cmd,uint8_t * cmdData)
{
    return 0;
}